// Assuming you have a text file 'data.txt' with the content "apple,banana,orange,grape"
fetch('data.json')
  .then(response => response.text())
  .then(data => {
    const dataArray = data.split(',');
    const table = document.getElementById('data-table');
  console.log(table);
    dataArray.forEach(item => {
      const row = table.insertRow(-1);
      const cell = row.insertCell(0);
      cell.textContent = item;
    });
  });